package com.baizhi.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("file")
public class FileFethcer {

    private static Logger log=LoggerFactory.getLogger(FileFethcer.class);

    @RequestMapping("upload")
    public Map uploadFile(MultipartFile file) throws IOException {
        Map map = new HashMap();
        String fileName=file.getOriginalFilename();
        file.transferTo(new File("f:\\1",fileName));
        log.info("=====文件上传=======");
        map.put("filename", fileName);
        map.put("code",0);

        return map;
    }
}
